package com.lord.otter.component.infrastructure.retry.strategy;

import com.google.common.collect.Lists;
import io.netty.handler.timeout.ReadTimeoutException;
import org.springframework.http.converter.HttpMessageConversionException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.client.HttpClientErrorException;

import javax.net.ssl.SSLException;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;

/**
 * 默认异常处理
 *
 * @author lord
 * 2025/9/5 23:29
 */
public class DefaultExceptionHandler extends AbstractExceptionHandler {
    public DefaultExceptionHandler() {
        super(
                Lists.newArrayList(
                        HttpClientErrorException.class,
                        HttpRequestMethodNotSupportedException.class,
                        HttpMessageConversionException.class,
                        ServletRequestBindingException.class,
                        IllegalArgumentException.class,
                        UnsupportedOperationException.class,
                        SSLException.class,
                        MalformedURLException.class,
                        ProtocolException.class
                ),
                Lists.newArrayList(
                        ReadTimeoutException.class ,
                        ConnectException.class,
                        SocketTimeoutException.class,
                        NoRouteToHostException.class
                )
        );
    }
}
